<template>
  <el-button v-bind="$attrs" v-if="userInfoStore.buttons.includes(permission)">
    <slot />
  </el-button>
</template>

<script lang="ts" setup>
/*
  将来PermissionButton全局注册，当做el-button一样使用
    <PermissionButton type="primary" :icon="xxx">添加</PermissionButton>
*/
import { useUserInfoStore } from "@/stores/userInfo";

defineOptions({
  name: "PermissionButton",
});

defineProps<{
  permission: string;
}>();

const userInfoStore = useUserInfoStore();
</script>

<style scoped lang="scss"></style>
